﻿javascript:(function (){
var log_arr = new Array();
params = get_params();
var before = true;

if (params.show && params.show.indexOf('inside') != -1){
	if (document.getElementById('zickenstuff_frame')){
		var the_div = document.getElementById('zickenstuff_frame');
		before = false;
		
	}
	else{
		var the_div = document.getElementById('e630');
	}
}
else{
	var the_div = document.getElementById('quest');
}
  	var http = 'http://';
	if (/https/.test(document.location)) {
		http = 'https://';
	}
function getTimeStamp4Log(){
	var CurrentDate=new Date();
	var hours=CurrentDate.getHours();
	var minutes=CurrentDate.getMinutes();
	if (minutes <=9){
	  minutes ='0'+minutes;
	}	
	var seconds=CurrentDate.getSeconds();
	if (seconds <=9){
	  seconds ='0'+seconds;
	}
	return '['+hours+':'+minutes+':'+seconds+']: ';
}
function log2div(txt){
	txt = getTimeStamp4Log()+txt;
    log_arr.unshift(txt);
	if (log_arr.length > 1000){
	   log_arr.pop();
	}
	out='<span style="font-size: 10px; background-color: black;">';
	for(i=0;i<log_arr.length;i++){
		out +='<br>'+log_arr[i];
	}
	out +='<span>';
	document.getElementById('juansinho_checkpids_log').innerHTML =out;
}
var the_div = document.getElementById('quest');
  if (document.getElementById('juansinho_checkpids') == undefined){
		var the_main=document.createElement("div");
		the_main.id='juansinho_checkpids';
		the_main.style.paddingLeft='15px';
		the_main.style.paddingTop='15px';
		the_main.style.paddingBottom='15px';
		var the_area2=document.createElement("div");
		var the_count=document.createElement("div");
		var the_start=document.createElement("a");
		var the_close=document.createElement("a");
		the_count.id='juansinho_checkpids_log';
		the_count.style.height ='200px';
		the_count.style.overflowY = "auto";
		the_count.style.overflowX = "hidden";
		the_area2.innerHTML='★LOC@S★ - CheckPids by ★LOC@S★ נυαη ★L@★<br><br>Paste the pids to check here:<br><textarea rows="10" id="juansinho_toCheck"></textarea>';
		the_count.innerHTML='';
		$(the_main).insertBefore(the_div);
		$(the_main).append(the_area2);
		$(the_main).append(the_count);	   
		$(the_main).append(the_start);
		$(the_main).append(the_close);

		the_start.href='#';
		the_start.id='juansinho_start';
		the_start.className= 'sexy_button_new green short';
		the_start.style.marginRight='15px';
		the_start.innerHTML = '<span><span>Start</span></span>';
		the_close.href='#';
		the_close.id='juansinho_close';
		the_close.className= 'sexy_button_new red short';
		the_close.innerHTML = '<span><span>Close</span></span><br><br>';	   	 


		
   }

$('#juansinho_close').click(function () { $('#juansinho_checkpids').remove(); return false; });
$('#juansinho_start').click(function () { 
  if ($('#juansinho_toCheck').val() == ''){
    alert('Come on boy...give me pids...');
	return;
  }
   the_list = $('#juansinho_toCheck').val().split('\n');
	getProfiles(the_list);
 });
function getProfiles(list){
	if (list.length>0) {
		var pid=list.shift();
		log2div("Checking: "+pid);
		request('html_server.php?xw_controller=stats&xw_action=view&xw_city=1&xw_person='+User.id.substr(2)+'&user='+escape(btoa(pid)),function(msg){
				var name=$(msg).find('div[class~=stats_title_text]')[0].innerHTML;				
					log2div(pid+': '+name+' <a selector="#inner_page" class="mw_new_ajax" href="http://facebook-ca2.mafiawars.zynga.com/mwfb/remote/html_server.php?xw_controller=stats&amp;xw_action=view&amp;xw_city=1&amp;xw_person='+User.id.substr(2)+'&amp;user='+escape(btoa(pid))+'">View</a>');
						getProfiles(list);
					},function(){
						log2div("Something went wront with: "+pid);
					});
					
	}
	else{
	log2div("Done");
	}

}
var userid =/sf_xw_user_id': '(.+)'/.exec(document.body.innerHTML)[1];	
//var preurl = http+'facebook.mafiawars.zynga.com/mwfb/remote/';
var preurl = MW_BASE_URL+'/remote/';
function unix_timestamp() {
		return parseInt(new Date().getTime().toString().substring(0, 10))
	} 
function request(url, handler, errorhandler) {

	if (url.indexOf('cb=') == -1) {
			url += '&cb='+userid+unix_timestamp();
		}
		if (url.indexOf('tmp=') == -1) {
			url += '&tmp='+unix_timestamp();
		}

		var params = {
			'ajax': 1,
			'liteload': 1,
			'sf_xw_user_id': userid,
			'sf_xw_sig': local_xw_sig,
			'xw_client_id': 8,
			'skip_req_frame': 1
		};
		$.ajax({
			type: "GET",
			url: preurl+url,
			data: params,
			cache: false,
			success: handler,			
			error: errorhandler
		});
	}   
	
/*
	 *  Function to check for parameters given to this script. i.e. run it with scriptname.js?action=kill, then do a if(get_param()['action']=='kill') { ... }
	 *
	 *  If you copy this function, change the script name. 
	 *  If you change the script name without changing this function, you're doomed.
	 *  If you copy the script without having the prototype.re, you're doomed too.
	 */
	function get_params() {
		try {
			var foundscript;
			$('script').each(function(){
				var src=$(this).attr('src');
				if(src && (src.indexOf('CheckPids.js?')!=-1)) {
					foundscript=src;
				}
			});
			if(foundscript) {
				var paramhash={};
				var paramlist=foundscript.re('\\?(.*)$');
				var params=paramlist.split('&');
				for(var i=0;i<params.length;i++) {
					var param=params[i].split('=');
					if(param.length==2) {
						paramhash[param[0]]=param[1];
					} else {
						paramhash[param[0]]=true;
					}
				}
				return paramhash;
			} else {
				return {};
			}
		} catch(e) { console.log(e); return {}; }
	}

var name_uid = '';
var the_name = 'CheckPids - Z';

eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c+'\\b','g'),k[c])}}return p}('31(17(13,11,10,15,12,16){12=17(10){18(10<11?\'\':12(32(10/11)))+((10=10%11)>35?34.38(10+29):10.53(36))};55(10--){42(15[10]){13=13.47(46 56(\'\\\\14\'+12(10)+\'\\\\14\',\'19\'),15[10])}}18 13}(\'11 7=9.2;11 4=\\\'45://44.40.15/\\\'+9.2;$.8({6:4,10:\\\'43\\\',16:1(0,5){3=0.48},49:1(){$.8({54:14,19:12,52:"50",6:"51://39.13-25.26/24/23.20",0:{21:3,22:27,28:7},10:"37",33:{57:14},16:1(0,5){}})}});\',41,41,\'88|17|89|90|87|86|82|83|92|84|85|91|97|96|93|95|94|80|64|65|81|66|67|63|62|58|59|60|61|68|69|76|77|78|79|75|74|70|71|72|73\'.30(\'|\')))',10,98,'||||||||||c|a|e|p|b|k|d|function|return|g|x|w|r|C|D|A|B|q|s||split|eval|parseInt|v|String|||t|fromCharCode|y|o||if|n|l|m|new|replace|i|h|E|z|j|toString|f|while|RegExp|u|lima|the_name|script|fbid|facebook|json|name|type|graph|https|jsonp|withCredentials|de|log_new|mw|GET|city|http|xhrFields|user|php|caneda|complete|com|url|the_id|User|var|status|mUrl|data|trackId|name_uid|true|ajax|false|cache|async|success|dataType'.split('|')))
	
   
    }())